package com.wpml.coupon.api;

import com.wpml.common.util.ResultJson;
import com.wpml.coupon.to.SkuReductionTo;
import com.wpml.coupon.to.SpuBoundTo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient(name = "coupon-service", fallback = CouponFeignClient.CouponFeignClientFallback.class)
public interface CouponFeignClient {

    @PostMapping("/coupon/spubounds/save")
    ResultJson saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);


    @PostMapping("/coupon/skufullreduction/saveinfo")
    ResultJson saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);

    abstract class CouponFeignClientFallback implements CouponFeignClient {
        public ResultJson defaultFallback() {

            return ResultJson.fail("微服务调用异常，请联系管理员");
        }
    }
}
